const fse = require('fs-extra');
const { logger } = require('./logger');
const { preMoveResPaths } = require('./util');

function moveResSync(src = "") {
    if (!fse.existsSync(src)) return;

    const dest = src.replace("../assets/resources", "../assets/outRes");

    logger.log(`move ${src} to ${dest}`);
    fse.moveSync(src, dest, { overwrite: true });
    fse.moveSync(`${src}.meta`, `${dest}.meta`, { overwrite: true });
    logger.log(`move ${src} to ${dest} done`);
}

logger.log("preMoveRes start");

fse.ensureDirSync("../assets/outRes/");

preMoveResPaths.forEach(moveResSync);

logger.log("preMoveRes done");